package red_book.year2024.month9;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 5
 * 1 4 2 5 3
 *
 * 1 2 3 4 5
 *
 * 3
 */

public class NoteSelect {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        String[]notes=new String[n];
        int []nums=new int[n];
        for (int i = 0; i < n; i++) {
            nums[i]=scanner.nextInt();
        }
        scanner.close();
        Arrays.sort(nums);
        for (int i = 0; i < n; i++) {
            notes[i]=Integer.toBinaryString(nums[i]);
        }
        long[]oneCount=new long[n];
        for (int i = 0; i < n; i++) {
            oneCount[i]=notes[i].chars().filter(ch -> ch == '1').count();
        }
        int[]dp=new int[n];
        dp[0]=1;
        for (int i=1;i<n;i++){
            int count=dp[i-1];
            for(int j=i-1;j>=0;j--){
                if(oneCount[i]==oneCount[j]&&nums[i]>nums[j]){
                    count=Math.max(count,dp[j]+1);
                }
            }
            dp[i]=count;
        }
        System.out.println(dp[n-1]);
    }
}
